package com.anne.fish.model;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

@Entity
@Table(name="info",catalog="fish")
@Searchable
@XmlRootElement
@org.hibernate.annotations.Entity(dynamicUpdate=true)
public class Info extends BaseObject implements Serializable {
    private Long id;
    private Integer typeId;
    private Integer provinceId;
    private Integer cityId;
    private Long uid;
    private String title;
    private String content;
    private Long createTime;
    private String ip;
    private boolean sellFlag;
    private boolean picFlag;
    private boolean auditFlag;
    private boolean personalFlag;
    private String tel;
    private String contact;
    private String qq;
    private String keywords;
    private String editPassword;
    private Integer money;
    private Long updateTime;
    private Long visitNum;
    private Long auditAdminId;

    private String picUrl;
    
   
    
	public Info( ) { 
	}
    
    
	public Info(Long id, String title, Long createTime, boolean picFlag,
			Integer money, String picUrl) {
		super();
		this.id = id;
		this.title = title;
		this.createTime = createTime;
		this.picFlag = picFlag;
		this.money = money;
		this.picUrl = picUrl;
	}

	@Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="type_id", nullable=false)
    @SearchableProperty
    public Integer getTypeId() {
        return this.typeId;
    }
    
    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }
    
    @Column(name="province_id", nullable=false)
    @SearchableProperty
    public Integer getProvinceId() {
        return this.provinceId;
    }
    
    public void setProvinceId(Integer provinceId) {
        this.provinceId = provinceId;
    }
    
    @Column(name="city_id", nullable=false)
    @SearchableProperty
    public Integer getCityId() {
        return this.cityId;
    }
    
    public void setCityId(Integer cityId) {
        this.cityId = cityId;
    }
    
    @Column(name="uid", nullable=false)
    @SearchableProperty
    public Long getUid() {
        return this.uid;
    }
    
    public void setUid(Long uid) {
        this.uid = uid;
    }
    
    @Column(name="title", nullable=false)
    @SearchableProperty
    public String getTitle() {
        return this.title;
    }
    @Column(name="pic_url", nullable=false)
    public String getPicUrl() {
		return picUrl;
	}

	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    @Column(name="content", nullable=false )
    @SearchableProperty
    public String getContent() {
        return this.content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    @Transient
    public String getCreateTimeStr(){
    	return super.convert(getCreateTime());
    }
    
    @Column(name="create_time", nullable=false)
    @SearchableProperty
    public Long getCreateTime() {
        return this.createTime;
    }
    
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
    
    @Column(name="ip", nullable=false, length=15)
    @SearchableProperty
    public String getIp() {
        return this.ip;
    }
    
    public void setIp(String ip) {
        this.ip = ip;
    }
    
    @Column(name="sell_flag", nullable=false)
    @SearchableProperty
    public boolean isSellFlag() {
        return this.sellFlag;
    }
    
    public void setSellFlag(boolean sellFlag) {
        this.sellFlag = sellFlag;
    }
    
    @Column(name="pic_flag", nullable=false)
    @SearchableProperty
    public boolean isPicFlag() {
        return this.picFlag;
    }
    
    public void setPicFlag(boolean picFlag) {
        this.picFlag = picFlag;
    }
    
    @Column(name="audit_flag", nullable=false)
    @SearchableProperty
    public boolean isAuditFlag() {
        return this.auditFlag;
    }
    
    public void setAuditFlag(boolean auditFlag) {
        this.auditFlag = auditFlag;
    }
    
    @Column(name="personal_flag", nullable=false)
    @SearchableProperty
    public boolean isPersonalFlag() {
        return this.personalFlag;
    }
    
    public void setPersonalFlag(boolean personalFlag) {
        this.personalFlag = personalFlag;
    }
    
    @Column(name="tel", nullable=false, length=20)
    @SearchableProperty
    public String getTel() {
        return this.tel;
    }
    
    public void setTel(String tel) {
        this.tel = tel;
    }
    
    @Column(name="contact", nullable=false, length=100)
    @SearchableProperty
    public String getContact() {
        return this.contact;
    }
    
    public void setContact(String contact) {
        this.contact = contact;
    }
    
    @Column(name="qq", nullable=false, length=100)
    @SearchableProperty
    public String getQq() {
        return this.qq;
    }
    
    public void setQq(String qq) {
        this.qq = qq;
    }
    
    @Column(name="keywords", nullable=false, length=100)
    @SearchableProperty
    public String getKeywords() {
        return this.keywords;
    }
    
    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }
    
    @Column(name="edit_password", nullable=false, length=100)
    @SearchableProperty
    public String getEditPassword() {
        return this.editPassword;
    }
    
    public void setEditPassword(String editPassword) {
        this.editPassword = editPassword;
    }
    
    @Column(name="money", nullable=false)
    @SearchableProperty
    public Integer getMoney() {
        return this.money;
    }
    
    public void setMoney(Integer money) {
        this.money = money;
    }
    
    @Column(name="update_time", nullable=false)
    @SearchableProperty
    public Long getUpdateTime() {
        return this.updateTime;
    }
    
    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }
    
    @Column(name="visit_num", nullable=false)
    @SearchableProperty
    public Long getVisitNum() {
        return this.visitNum;
    }
    
    public void setVisitNum(Long visitNum) {
        this.visitNum = visitNum;
    }
    
    @Column(name="audit_admin_id", nullable=false)
    @SearchableProperty
    public Long getAuditAdminId() {
        return this.auditAdminId;
    }
    
    public void setAuditAdminId(Long auditAdminId) {
        this.auditAdminId = auditAdminId;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Info pojo = (Info) o;

        if (typeId != null ? !typeId.equals(pojo.typeId) : pojo.typeId != null) return false;
        if (provinceId != null ? !provinceId.equals(pojo.provinceId) : pojo.provinceId != null) return false;
        if (cityId != null ? !cityId.equals(pojo.cityId) : pojo.cityId != null) return false;
        if (uid != null ? !uid.equals(pojo.uid) : pojo.uid != null) return false;
        if (title != null ? !title.equals(pojo.title) : pojo.title != null) return false;
        if (content != null ? !content.equals(pojo.content) : pojo.content != null) return false;
        if (createTime != null ? !createTime.equals(pojo.createTime) : pojo.createTime != null) return false;
        if (ip != null ? !ip.equals(pojo.ip) : pojo.ip != null) return false;
        if (sellFlag != pojo.sellFlag) return false;
        if (picFlag != pojo.picFlag) return false;
        if (auditFlag != pojo.auditFlag) return false;
        if (personalFlag != pojo.personalFlag) return false;
        if (tel != null ? !tel.equals(pojo.tel) : pojo.tel != null) return false;
        if (contact != null ? !contact.equals(pojo.contact) : pojo.contact != null) return false;
        if (qq != null ? !qq.equals(pojo.qq) : pojo.qq != null) return false;
        if (keywords != null ? !keywords.equals(pojo.keywords) : pojo.keywords != null) return false;
        if (editPassword != null ? !editPassword.equals(pojo.editPassword) : pojo.editPassword != null) return false;
        if (money != null ? !money.equals(pojo.money) : pojo.money != null) return false;
        if (updateTime != null ? !updateTime.equals(pojo.updateTime) : pojo.updateTime != null) return false;
        if (visitNum != null ? !visitNum.equals(pojo.visitNum) : pojo.visitNum != null) return false;
        if (auditAdminId != null ? !auditAdminId.equals(pojo.auditAdminId) : pojo.auditAdminId != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (typeId != null ? typeId.hashCode() : 0);
        result = 31 * result + (provinceId != null ? provinceId.hashCode() : 0);
        result = 31 * result + (cityId != null ? cityId.hashCode() : 0);
        result = 31 * result + (uid != null ? uid.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (sellFlag ? 1 : 0);
        result = 31 * result + (picFlag ? 1 : 0);
        result = 31 * result + (auditFlag ? 1 : 0);
        result = 31 * result + (personalFlag ? 1 : 0);
        result = 31 * result + (tel != null ? tel.hashCode() : 0);
        result = 31 * result + (contact != null ? contact.hashCode() : 0);
        result = 31 * result + (qq != null ? qq.hashCode() : 0);
        result = 31 * result + (keywords != null ? keywords.hashCode() : 0);
        result = 31 * result + (editPassword != null ? editPassword.hashCode() : 0);
        result = 31 * result + (money != null ? money.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (visitNum != null ? visitNum.hashCode() : 0);
        result = 31 * result + (auditAdminId != null ? auditAdminId.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("typeId").append("='").append(getTypeId()).append("', ");
        sb.append("provinceId").append("='").append(getProvinceId()).append("', ");
        sb.append("cityId").append("='").append(getCityId()).append("', ");
        sb.append("uid").append("='").append(getUid()).append("', ");
        sb.append("title").append("='").append(getTitle()).append("', ");
        sb.append("content").append("='").append(getContent()).append("', ");
        sb.append("createTime").append("='").append(getCreateTime()).append("', ");
        sb.append("ip").append("='").append(getIp()).append("', ");
        sb.append("sellFlag").append("='").append(isSellFlag()).append("', ");
        sb.append("picFlag").append("='").append(isPicFlag()).append("', ");
        sb.append("auditFlag").append("='").append(isAuditFlag()).append("', ");
        sb.append("personalFlag").append("='").append(isPersonalFlag()).append("', ");
        sb.append("tel").append("='").append(getTel()).append("', ");
        sb.append("contact").append("='").append(getContact()).append("', ");
        sb.append("qq").append("='").append(getQq()).append("', ");
        sb.append("keywords").append("='").append(getKeywords()).append("', ");
        sb.append("editPassword").append("='").append(getEditPassword()).append("', ");
        sb.append("money").append("='").append(getMoney()).append("', ");
        sb.append("updateTime").append("='").append(getUpdateTime()).append("', ");
        sb.append("visitNum").append("='").append(getVisitNum()).append("', ");
        sb.append("auditAdminId").append("='").append(getAuditAdminId()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
